package com.qunji.cpsdistribution.plusmain;

import com.baomidou.mybatisplus.enums.IdType;
import com.baomidou.mybatisplus.generator.AutoGenerator;
import com.baomidou.mybatisplus.generator.config.DataSourceConfig;
import com.baomidou.mybatisplus.generator.config.GlobalConfig;
import com.baomidou.mybatisplus.generator.config.PackageConfig;
import com.baomidou.mybatisplus.generator.config.StrategyConfig;
import com.baomidou.mybatisplus.generator.config.rules.DbType;
import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
/**
 * mybatis plus自动生成
 */
public class logisticsmain {
    public static void main(String[] args) {
        GlobalConfig config=new GlobalConfig();
        config.setActiveRecord(true).setAuthor("sjq").setOutputDir("C:\\Users\\SJQ\\Desktop\\work\\qunji-1.0-cps\\distribution-service\\distribution-logistics\\src\\main\\java").setFileOverride(true).setIdType(IdType.AUTO).setServiceName("%sService").setBaseResultMap(true).setBaseColumnList(true);//是否支持AR模式  作者   生产路径       文件覆盖    主键策略
        DataSourceConfig dsconfig=new DataSourceConfig();
        dsconfig.setDbType(DbType.MYSQL).setDriverName("com.mysql.jdbc.Driver").setUrl("jdbc:mysql://sh-cdb-9n74xf2i.sql.tencentcdb.com:61493/qunji-1.0-cpsdistribution").setUsername("williamsye").setPassword("williamsye-111");//数据库类型
        StrategyConfig stc=new StrategyConfig();//策略配置
        stc.setCapitalMode(true).setDbColumnUnderline(true).setNaming(NamingStrategy.underline_to_camel).setInclude("logistics");//全局大写命名
        PackageConfig pk=new PackageConfig();
        pk.setParent("com.qunji.cpsdistribution")
                .setMapper("mapper")
                .setService("service")
                .setController("controller")
                .setEntity("entity")
                .setXml("mapper");
        AutoGenerator ag=new AutoGenerator();
        ag.setGlobalConfig(config).setDataSource(dsconfig).setStrategy(stc).setPackageInfo(pk);
        ag.execute();
    }
}
